package com.atguigu.dao;

import com.atguigu.bean.User;
import org.junit.Test;

import java.util.List;

/**
 * Date:2020/8/28
 * Author:ybc
 * Description:
 */
public class UserDao extends BaseDao<User> {

    @Test
    public void testInsert(){
        String sql = "insert into t_user values(null,?,?,?,?)";
        int result = update(sql, "ybc", "123", "男", "100");
        System.out.println("结果-->"+result);
    }

    @Test
    public void testSelect(){
        String sql = "select * from t_user";
        List<User> list = getBeanList(User.class, sql);
        for (User user : list) {
            System.out.println(user);
        }
    }

    @Test
    public void testSelectOne(){
        String sql = "select * from t_user where id = ?";
        User user = getBean(User.class, sql, 1);
        System.out.println(user);
    }
}
